const fs = require('fs');
const os = require('os');

const text = 'append text'+os.EOL;
fs.appendFile('./test.txt',text, function(err){
 if(err){
  console.log('error', err)
 }else{
  console.log('append success');
  fs.readFile('./test.txt', function(err,data){
    if(err){
     console.log(err)
    }else{
      console.log(data.toString('utf-8'));
    }
  })
 }
})
